<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
// hard line break with BiDi
selection_test(
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-0 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0|\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0^\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-1 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1|\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1^\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-2 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2| abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2^ abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-3 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 |abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2 ^abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-4 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 a|bc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2 a^bc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-5 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 ab|c \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2 ab^c \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-6 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc| \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2 abc^ \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-7 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc |\u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2 abc ^\u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-8 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3|\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2 abc \u05D3^\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-9 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4|\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">|\u05D0\u05D1\u05D2 abc \u05D3\u05D4^\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-10 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 abrebg</div>',
  '20-11 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>e|df \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|e^df \u05D6\u05D7\u05D8 abrebg</div>',
  '20-12 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>ed|f \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|ed^f \u05D6\u05D7\u05D8 abrebg</div>',
  '20-13 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf| \u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf^ \u05D6\u05D7\u05D8 abrebg</div>',
  '20-14 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf |\u05D6\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf ^\u05D6\u05D7\u05D8 abrebg</div>',
  '20-15 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6|\u05D7\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6^\u05D7\u05D8 abrebg</div>',
  '20-16 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7|\u05D8 abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7^\u05D8 abrebg</div>',
  '20-17 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8| abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8^ abrebg</div>',
  '20-18 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 |abrebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 ^abrebg</div>',
  '20-19 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 a|brebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 a^brebg</div>',
  '20-20 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 ab|rebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 ab^rebg</div>',
  '20-21 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abr|ebg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 abr^ebg</div>',
  '20-22 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abre|bg</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 abre^bg</div>',
  '20-23 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abreb|g</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 abreb^g</div>',
  '20-24 rtl backward lineboundary');

selection_test(
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>edf \u05D6\u05D7\u05D8 abrebg|</div>',
  selection => selection.modify('extend', 'backward', 'lineboundary'),
  '<div contenteditable dir="rtl">\u05D0\u05D1\u05D2 abc \u05D3\u05D4\u05D5<br>|edf \u05D6\u05D7\u05D8 abrebg^</div>',
  '20-25 rtl backward lineboundary');
</script>
